<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 200px;
            height: 200px;
            font-size: 100px;
            text-align: center;
            line-height: 200px;
            border: 1px solid black;
            border-radius: 50%;
        }

        .function {
            width: 200px;
            display: flex;
            flex-direction: row;
            justify-content: space-between;
        }

        div {
            margin: 0 auto;
        }
    </style>
</head>

<body>
    <br>
    <br><br><br>
    <div class="box"></div>
    <br>
    <div class="function">
        <input type="button" value="开始" id="start">
        <input type="button" value="暂停" id="pause">
        <input type="button" value="置位" id="reset">
    </div>
</body>
<script>
    var tick = document.getElementsByClassName("box")[0];
    var start = document.getElementById("start");
    var pause = document.getElementById("pause");
    var reset = document.getElementById("reset");
    var t;
    var i;
    var j;
    var a = 9;
    start.onclick = function () {
        if (i != 0) {
            a = a;
        } else {
            a = 9;
        }
        reset.onclick = function () {
            a = 9;
            clearInterval(t)
        }
        t = setInterval(function () {
            i = a;
            if (i > 0) {
                j = i;
                i--;
                a = i;
            }
            else {
                j = 0;
                clearInterval(t);
            }
            pause.onclick = function () {
                i = a;
                j = j;
                clearInterval(t);
            }
            console.log(j)
            tick.innerHTML = j
        }, 1000)
    }
 
</script>

</html>